﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace 学生信息管理系统
{
    public partial class Manager : Form
    {
        public Manager()
        {
            InitializeComponent();
        }

        private void 显示学生登录信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string cn_str = pub.CN_STR;
            OleDbConnection cn = new OleDbConnection(cn_str);              //建立数据库连接
            cn.Open();
            string select = "select * from 学生登录 ";
            OleDbCommand cmd = new OleDbCommand(select, cn);                 //建立数据库命令
            OleDbDataReader reader = cmd.ExecuteReader();
            DataTable dt = new DataTable();
            dt.Load(reader);
            this.dataGridView1.DataSource = dt;
            cn.Close();
        }

        private void 显示教师登录信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string cn_str = pub.CN_STR;
            OleDbConnection cn = new OleDbConnection(cn_str);              //建立数据库连接
            cn.Open();
            string select = "select * from 教师登录 ";
            OleDbCommand cmd = new OleDbCommand(select, cn);                 //建立数据库命令
            OleDbDataReader reader = cmd.ExecuteReader();
            DataTable dt = new DataTable();
            dt.Load(reader);
            this.dataGridView1.DataSource = dt;
            cn.Close();
        }

        private void 编辑学生登录信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //ManagerSMessage f = new ManagerSMessage();
            //this.IsMdiContainer = true;
            //f.MdiParent = this;
            //f.Show();

            this.IsMdiContainer = true;
            #region

            if (Application.OpenForms["ManagerSMessage"] == null)
            {
                ManagerSMessage child = new ManagerSMessage();
                child.MdiParent = this;
                child.Show();
            }
            else//有Name为FrmChildren的子船体，就直接show()
            {
                Application.OpenForms["ManagerSMessage"].Show();
            }
            #endregion

        }

        private void 编辑学生登录信息ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            //ManagerTMessage f = new ManagerTMessage();
            //this.IsMdiContainer = true;
            //f.MdiParent = this;
            //f.Show();

            this.IsMdiContainer = true;
            #region

            if (Application.OpenForms["ManagerTMessage"] == null)
            {
                ManagerTMessage child = new ManagerTMessage();
                child.MdiParent = this;
                child.Show();
            }
            else//有Name为FrmChildren的子船体，就直接show()
            {
                Application.OpenForms["ManagerTMessage"].Show();
            }
            #endregion

        }

        private void 返回主页面ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Login ff = new Login();
            ff.Show();
            this.Hide();
        }

        
    }
}
